import type Typings from "@/typings";

const createLevel = () => {
  const level = [
    { name: "重要", code: "1", tag: "danger" },
    { name: "高", code: "2", tag: "success" },
    { name: "中", code: "3", tag: "primary" },
    { name: "低", code: "4", tag: "info" },
  ] as const;

  return JSON.parse(JSON.stringify(level)) as Typings.Common.option<
    (typeof level)[number]["name"],
    (typeof level)[number]["code"]
  >[];
};

const createSf = () => {
  const level = [
    { name: "是", code: "1", tag: "danger" },
    { name: "否", code: "2", tag: "primary" },
  ] as const;

  return JSON.parse(JSON.stringify(level)) as Typings.Common.option<
    (typeof level)[number]["name"],
    (typeof level)[number]["code"]
  >[];
};

const createGender = () => {
  const level = [
    { name: "男", code: "1", tag: "danger" },
    { name: "女", code: "2", tag: "primary" },
  ] as const;

  return JSON.parse(JSON.stringify(level)) as Typings.Common.option<
    (typeof level)[number]["name"],
    (typeof level)[number]["code"]
  >[];
};

export default {
  level: createLevel(),
  sf: createSf(),
  gender: createGender(),
};
